﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Classified.Domain.Entities
{
   public class ClassifiedCategoryAttribute
    {
       [Key]
       public int Id { get; set; }
       public int CategoryId { get; set; }
       [Required]
       public string Attr_Label { get; set; }
       [Required]
       [RegularExpression(@"(\S)+", ErrorMessage = "White space is not allowed")]
       public string Attr_Name { get; set; }
        [Display(Name = "Search By")]
       public int AttributesSearchBy { get; set; }
       [Display(Name = "Control Type")]
       public int AttributeControlTypeId { get; set; }
       [ForeignKey("CategoryId")]
       public virtual ClassifiedCategory ClassifiedCategories { get; set; }

       public virtual List<AttributeValue> AttributeValues { get; set; }

      
      
    }
    public class AttributeValue
    {
        [Key]
        public int Id { get; set; }
        public int Attr_Id { get; set; }
        public string Value { get; set; }
        [ForeignKey("Attr_Id")]
        public virtual ClassifiedCategoryAttribute ClassifiedCategoryAttributes { get; set; }
        public virtual ICollection<ClassifiedAd> ClassifiedAds { get; set; }
    }

    public class ClassifiedAttribute
    {
        [Key]
        public int Id { get; set; }
        public int ClassifiedId { get; set; }
        public int Attr_Id { get; set; }
        public string Value { get; set; }
        [ForeignKey("Attr_Id")]
        public virtual ClassifiedCategoryAttribute ClassifiedCategoryAttributes { get; set; }
        [ForeignKey("ClassifiedId")]
        public virtual ClassifiedAd ClassifiedAds { get; set; }
    }
}
